#include <iostream>
#include <stack>
#include <string>
#include <map>

using namespace std;

int main() {
    string s;
    getline(cin, s);

    stack<char> st;
    map<char, char> brackets = { {'(', ')'}, {'[', ']'}, {'{', '}'}, {'<', '>'} };

    for (char c : s) {
        if (brackets.find(c) != brackets.end()) {
            st.push(c);
        } else if (brackets.count(st.top()) && brackets[st.top()] == c) {
            st.pop();
        } else {
            cout << "False" << endl;
            return 0;
        }
    }

    cout << (st.empty() ? "True" : "False") << endl;

    return 0;
}
